package com.it.zhangjun.design.pattern.visitor;

/**
 * @className: ConcretePackage
 * @description: 具体套餐，苹果、香蕉、橘子
 * @author: z00018123
 * @date: 2021/4/30
 **/
public class ConcretePackage implements FruitPackage {
    Apple apple;
    Orange orange;
    Banana banana;

    public ConcretePackage(Apple apple, Orange orange, Banana banana) {
        this.apple = apple;
        this.orange = orange;
        this.banana = banana;
    }

    @Override
    public void accept(Visitor visitor) {
        visitor.visitApple(apple);
        visitor.visitOrange(orange);
        visitor.visitBanana(banana);
    }

    @Override
    public double getPrice() {
        return apple.getPrice() + orange.getPrice() + banana.getPrice();
    }
}
